package com.newtouch.bxzs.common.base.em;

/**
 * 个人客户证件类型返回枚举
 *
 * <p>
 * <b>History:</b>
 * <table border="1">
 * <tr>
 * <th>Date</th>
 * <th>Operator</th>
 * <th>Memo</th>
 * </tr>
 * <tr>
 * <td>2020年12月23日</td>
 * <td>lingshouyi</td>
 * <td>Create</td>
 * </tr>
 * </table>
 *
 * @author lingshouyi
 *
 * @version 1.0.0
 * @since 1.0.0
 */
public enum CustomerCardTypeEnum {
	// 身份证
	ID_CARD("1", "身份证"),
	// 护照
	PASS_PORT("2", "护照"),
	// 户口本
	HOUSEHOLD_REGISTER("3", "户口本"),
	// 军官证
	SOLDIER_CARD("4", "军官证"),
	// 港澳通行证
	HONGKONG_MACAO_PASS("5", "港澳通行证"),
	// 其他
	OTHER("6", "其他");

	private String code;

	private String name;

	CustomerCardTypeEnum(String code, String name) {
		this.code = code;
		this.name = name;
	}

	public Integer toInteger() {
		return Integer.parseInt(this.code);
	}

	public String getCode() {
		return code;
	}

	public String getName() {
		return name;
	}

	public static String getNameByCode(Object object) {
		String code = String.valueOf(object);
		for (CustomerCardTypeEnum cardType : CustomerCardTypeEnum.values()) {
			if (cardType.getCode().equals(code)) {
				return cardType.getName();
			}
		}
		return null;
	}

}
